<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script type="module">
        import IndexDB from './IndexDB.js'
        function log(e){
            console.log(e.target.result,e)
        }
        (async function(){
            let dbName = 'admin', storeName = 'id', keyPath="id", version = 1;
            const db = await IndexDB.openDB(dbName,storeName,keyPath,version);
            var data = await IndexDB.addData(db,storeName,{
                id:Date.now(),
                username:'张',
                phone:'123456',
                age:22,
                weight:75
            })
            log(data)
            // var data = await IndexDB.updateDb(db, storeName,{
            //     id:1648363399760,
            //     username:'张一',
            //     phone:'111',
            //     age:22,
            //     weight:75
            // })
            // log(data)
            // var data = await IndexDB.getData(db, storeName, "张一")
            // log(data)
            // var data = await IndexDB.deleteData(db, storeName,"1648363399760")
            // log(data)
            // var data = await IndexDB.deleteDB(dbName)
            // log(data)
        })()
    </script>
</body>

</html>